/*
 *  Copyright (c) 2013 The CCP project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
 *  that can be found in the LICENSE file in the root of the web site.
 *
 *   http://www.cloopen.com
 *
 *  An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */
package com.molichuxing.services.sdk.sms;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.lang3.StringUtils;

public class PropertiesUtil {


    public static Properties getPropertie(int level) {
        String loggerLever = "all";
        if (level == 1) {
            loggerLever = "info";
        } else if (level == 2) {
            loggerLever = "warn";
        } else if (level == 3) {
            loggerLever = "error";
        } else if (level == 4) {
            loggerLever = "fatal";
        }
        Properties props = new Properties();

        props.setProperty("log4j.rootLogger", loggerLever + ",A,R");
        props.setProperty("log4j.appender.A", "org.apache.log4j.ConsoleAppender");
        props.setProperty("log4j.appender.A.layout", "org.apache.log4j.PatternLayout");
        props.setProperty("log4j.appender.R", "org.apache.log4j.RollingFileAppender");
        props.setProperty("log4j.appender.R.File", "log.txt");
        props.setProperty("log4j.appender.R.MaxFileSize", "100KB");
        props.setProperty("log4j.appender.R.MaxBackupIndex", "1");
        props.setProperty("log4j.appender.R.layout", "org.apache.log4j.PatternLayout");
        props.setProperty("log4j.appender.R.layout.ConversionPattern", "%p %t %c - %m%n");

        return props;
    }

    public static String getMessage(String key) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("A", "正常");
        map.put("B", "超分");
        map.put("C", "转出");
        map.put("D", "暂扣");
        map.put("E", "撤销");
        map.put("F", "吊销");
        map.put("G", "注销");
        map.put("H", "违法未处理");
        map.put("U", "扣留");
        map.put("I", "事故未处理");
        map.put("J", "停止使用");
        map.put("K", "协查");
        map.put("L", "锁定");
        map.put("M", "逾期未换证");
        map.put("N", "延期换证");
        map.put("P", "延期体检");
        map.put("R", "逾期未体检");
        map.put("Z", "其他");
        map.put("S", "逾期未审验");
        String value = map.get(key);
        if (!StringUtils.isEmpty(value)) {
            return value;
        } else {
            return "";
        }
    }

}
